<template>
	<div class="page-row p-x-0">
		<div class="box-left">
			<el-menu default-active="1" @select="change" class="el-menu-vertical-demo">
				<el-menu-item index="1">
					<span slot="title">器官MIORGDEF_ORG1</span>
				</el-menu-item>
				<el-menu-item index="2">
					<span slot="title">器官MIORGDEF_ORG2</span>
				</el-menu-item>
				<el-menu-item index="3">
					<span slot="title">食入模块农作物CONSUMPT_NAM</span>
				</el-menu-item>
				<el-menu-item index="4">
					<span slot="title">途径类型</span>
				</el-menu-item>
			</el-menu>
		</div>
		<div class="box-right p-0">
			<div class="page-wrap">
				<div class="page-content p-0">
					<div class="page-column p-0">
						<div class="table-box">
							<el-table
								height="100%"
								v-loading="loading"
								:data="tableData.columnData"
								border
							>
								<el-table-column prop="dic_id" label="编号" align="center" show-overflow-tooltip></el-table-column>
								<el-table-column prop="dic_ename" label="英文名" align="center"></el-table-column>
								<el-table-column prop="dic_cname" label="中文名" align="center"></el-table-column>
							</el-table>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</template>

<script>
import { ZD_GET_DICINFOS } from "@/service/hd5.js"
export default {
	name: "sysPara", // 系统参数
	props: {},

	data() {
		return {
			key: 0,
			showinput: false,
			treeData: [],
			filterText: "",
			defaultProps: {
				label: "name",
				isLeaf: "isLeaf",
			},
			currentNode: {},
			tableData: {
				columns: "orderNum",
				orders: "ASC",
				currentPage: 1,
				pageSize: 15,
				total: 0,
				columnData: [],
			},
			selection: [],
			loading: false,
		}
	},
	mounted() {
		this.queryTabData(1)
	},
	methods: {
		queryTabData(id) {
			let params = {
				dictypeid: id,
			} 
			this.loading = true

			this.$appApi
				.ZD_GET_DICINFOS(params)
				.then((res) => {
					var str = res.data.substring(0, 1)
					if (str == "E") {
						let message = res.data.substring(6)
						this.$notify.error({
							title: "请求数据失败！",
							message: message,
							type: "success",
						})
					} else if (str == "S") {
						this.tableData.columnData = JSON.parse(
							res.data.substring(8)
						)
						this.loading = false
					}
				})
				.catch((err) => {
					console.log(err)
				})
		},
		change(index) {
			console.log(index)
			this.queryTabData(index)
		},
	},
}
</script>

<style lang="scss" scoped>
</style>